<template>
	<view>
		<view class="detail-v1">01 detail</view>
		<view class="content">{{ paramsUrl }}</view>
	</view>
</template>

<script setup>
	import { ref, getCurrentInstance } from 'vue'
	import { onLoad } from '@dcloudio/uni-app'
	
	const paramsUrl = ref('')
	const eventChannelValue = ref('')
	
	// 方式一. ?name=liujun&id=100
	const props = defineProps({
		name: String,
		id: String
	})
	console.log('在props中接受传递过来url的数据:', props.name, props.id);
	paramsUrl.value =  props.name + " - " + props.id
	
	// 方式二: onLoad
	const instane = ref(getCurrentInstance().proxy)
	onLoad((options) => {
		console.log('options接受到传递过来url的数据:', options);
		const eventChannel = instane.value.getOpenerEventChannel()
		eventChannel.on('acceptDataV1', (value) => {
			console.log('接收到页面acceptDataV1传递过来的数据:', value);
			eventChannelValue.value = value
		})
	})
	
</script>

<style>
	       
</style>
